/**
 * There are <a href="https://www.hdzhx.com">邯郸智讯</a> code generation
 */
package com.boxin.ims.modules.wechat.score.entity;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.validator.constraints.Length;

import com.thinkgem.jeesite.common.persistence.BaseEntity;
import com.thinkgem.jeesite.modules.sys.entity.User;

/**
 * 积分对换设置Entity
 * @author Jakemanse
 * @version 2013-09-23
 */

@Entity
@Table(name = "wp_score_exchange")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class ScoreExchange extends BaseEntity {
	
	public final static String CYCLE_NO_LIMIT = "0";
	public final static String CYCLE_YEAR = "1";
	public final static String CYCLE_MONTH = "2";
	public final static String CYCLE_WEEK = "3";
	public final static String CYCLE_DAY = "4";
	
	private static final long serialVersionUID = 1L;
	private Long id; 		// 编号
	private User user; 		// 用户
	private String name; 	// 名称
	private Integer score;	// 分值  对换所需的分值
	private Boolean autoClear;	//是否自动核销
	private String cycleType;		//周期类型   0:不限   1:按年    2:按月     3:按日
	//private String payType;		//兑换支付方式          1:积分   2：金钱
	private String message;		//对换积回复内容  关键字
	private Integer validDays;	//有效天数
	private Date startTime;	//生效时间
	private Date endTime;	//失效时间
	private Date createTime;	// 创建日期
	private String delFlag;	// 删除标记（0：正常；1：删除）
	private String remarks; // 备注
	private String showPic;//兑换商品的展示图片
	private Integer count = 0; //可兑换次数，0时为不限
	
	private String type;//0商家自己     1   微购物
	private Integer sort;//排序
	
	private String payType;//积分支付方式    0  积分支付     1活动积分支付		2三级活动积分兑换
	
	private Integer number;//总数量
	private Integer exchangeNumber;//兑换数量
	private Integer money;		//对应的储值或红包的值      以分为单位存储
	private Long couponId;//优惠券配置id
	
	private String xqing;
	private String iskou;//是否为口罩 0：不是	1：是
	
	

	public ScoreExchange() {
		this.createTime = new Date();
		this.startTime = new Date();
		this.endTime = new Date();
		this.delFlag = DEL_FLAG_NORMAL;
		this.autoClear = false;
		this.cycleType = "0";
		this.type="0";
	}

	public ScoreExchange(Long id){
		this();
		this.id = id;
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	//@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_score_scoreExchange")
	//@SequenceGenerator(name = "seq_score_scoreExchange", sequenceName = "seq_score_scoreExchange")
	public Long getId() {
		return id;
	}
	
	

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne
	@JoinColumn(name="user_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	
	@Length(min=1, max=200)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Length(min=0, max=255)
	public String getRemarks() {
		return remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}
	
	@NotNull
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Length(min=1, max=1)
	public String getDelFlag() {
		return delFlag;
	}

	public void setDelFlag(String delFlag) {
		this.delFlag = delFlag;
	}

	public Integer getScore() {
		return score;
	}

	public void setScore(Integer score) {
		this.score = score;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}


	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	public Integer getValidDays() {
		return validDays;
	}

	public void setValidDays(Integer validDays) {
		this.validDays = validDays;
	}

	public String getShowPic() {
		return showPic;
	}

	public void setShowPic(String showPic) {
		this.showPic = showPic;
	}

	public Integer getCount() {
		return count;
	}

	public void setCount(Integer count) {
		this.count = count;
	}

	public Boolean getAutoClear() {
		return autoClear;
	}

	public void setAutoClear(Boolean autoClear) {
		this.autoClear = autoClear;
	}

	@Transient
	public boolean isAutoClear() {
		return getAutoClear() != null && getAutoClear();
	}

	public String getCycleType() {
		return cycleType;
	}

	public void setCycleType(String cycleType) {
		this.cycleType = cycleType;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public Integer getSort() {
		return sort;
	}

	public void setSort(Integer sort) {
		this.sort = sort;
	}

	public String getPayType() {
		return payType;
	}

	public void setPayType(String payType) {
		this.payType = payType;
	}

	public Integer getNumber() {
		return number;
	}

	public void setNumber(Integer number) {
		this.number = number;
	}

	public Integer getExchangeNumber() {
		return exchangeNumber;
	}

	public void setExchangeNumber(Integer exchangeNumber) {
		this.exchangeNumber = exchangeNumber;
	}

	public Integer getMoney() {
		return money;
	}

	public void setMoney(Integer money) {
		this.money = money;
	}

	public Long getCouponId() {
		return couponId;
	}

	public void setCouponId(Long couponId) {
		this.couponId = couponId;
	}

	public String getXqing() {
		return xqing;
	}

	public void setXqing(String xqing) {
		this.xqing = xqing;
	}

	public String getIskou() {
		return iskou;
	}

	public void setIskou(String iskou) {
		this.iskou = iskou;
	}

	
	
}


